<?php
//GD登录验证
//需要verify.php支持
session_start();
echo $_SESSION['verify'];
var_dump($_POST);
$verify=$_SESSION['verify'];
if($_POST==null){
	//什么也不做
}elseif($_POST['verify']==NULL){
	echo "<script>";
	echo "alert('哥们，你验证码没输入啊！');";
//	echo "window.location.href='';";
	echo "</script>";
}elseif($verify==$_POST['verify']){
	echo "<script>";
	echo "alert('验证码正确，验证通过！');";
//	echo "window.location.href='';";
	echo "</script>";
}else{
	echo "<script>";
	echo "alert('验证码错误!');";
//	echo "window.location.href='';";
	echo "</script>";
}
?>
<html>
	<head>
		<title>验证码</title>
	</head>
	<body>
		<div style="padding: 30px; width: 60%;margin: 60 auto; border: black 1px solid;">
			<span>验证码：</span>
			<img id="verImg" onclick="changeImg()" width="100" height="30" align="absmiddle" src="verify.php" title="看不清，换一张"/>
			<span onclick="changeImg()">看不清，换一张</span>
			<form style="margin-top: 50px;" action="#" method="post">
				<input type="text" name="verify" placeholder="请输入验证码..."/>
				<input type="submit" id="" name="" value="提交" />
			</form>
		</div>
	</body>
	<script type="text/javascript">
		function changeImg(){
			verImg.src="verify.php?id="+new Date();
		}
	</script>
</html>
